﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SilverlightPlayground.RFB.Silverlight
{
    public partial class Installer : UserControl
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="Installer"/> class.
        /// </summary>
        public Installer()
        {
            InitializeComponent();
            this.hbInstall.Click += new RoutedEventHandler(hbInstall_Click);

            if (Application.Current.InstallState == InstallState.Installed)
                txtInstalled.Visibility = System.Windows.Visibility.Visible;
            else
                hbInstall.Visibility = System.Windows.Visibility.Visible;
        }

        /// <summary>
        /// Handles the Click event of the hbInstall control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        void hbInstall_Click(object sender, RoutedEventArgs e)
        {
            Application.Current.Install();
        }
    }
}
